package com.zsummer.demo.cloudseataservice2;

/**
 * @author zsummer
 * @since 2022/2/14
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 库存controller
 */
@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    private StockService stockService;


    /**
     *
     * @param productName
     * @param orderCnt
     * @return
     */
    @GetMapping("/deduct")
    public String deductStock(@RequestParam("productName") String productName, @RequestParam("orderCnt") long orderCnt) {
        stockService.deductStock(productName, orderCnt);
        return "success";
    }
}
